#pragma once
#include <iostream>
#include <queue>
#include <vector>
#include <string>
#include <functional>
#include <vector>
#include "Thread.hpp"

const static int defaultnum = 5;

template <class T>
class ThreadPool
{
private:
    void Routine()
    {
        while(true)
        {
            
        }
    }
public:
    ThreadPool(int threadnum = defaultnum)
        : _threadnum(threadnum)
    {
        for (int i = 0; i < _threadnum; i++)
        {
            std::string threadname = "thread-" + std::to_string(i);
            _threads.emplace_back([]() {
                Routine();
            },
                                  threadname);
        }
    }
    void Start()
    {
        for(auto&thread:_threads)
        {
            thread.Start();
        }
    }
    void Enqueue(const T &in)
    {
    }
    void Pop(T *out)
    {
    }

    void Wait()
    {
        for(auto&thread:_threads)
        {
            thread.Join();
        }
    }
    ~ThreadPool() {}

private:
    std::queue<T> _queue;         // 任务队列
    int _threadnum;               // 线程数量
    std::vector<Thread> _threads; // 线程池
};